package day01;

/**
 * @author Jetwang
 * @version 1.0
 * @since 2023/2/28 9:46
 * 字符串倒序打印
 */
public class SingleRecursion03 {

    public static void main(String[] args) {
        String str = "Hello World";
        strReverse(str.length() -1 , str);
    }

    public static void strReverse(int n, String str) {
        /*if (n == str.length()) {
            return;
        }
        strReverse(n + 1, str);
        System.out.println(str.charAt(n));*/

        if (n == -1) {
            return;
        }
        System.out.println(str.charAt(n));
        strReverse(n - 1, str);
    }
}
